package com.game.fighting.component;

import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.component.Component;
import com.almasb.fxgl.physics.BoundingShape;
import com.almasb.fxgl.physics.HitBox;
import javafx.geometry.Point2D;

/**
 * @author LeeWyatt
 */
public class ArrowComponent extends Component {
    static int index = 0;
    @Override
    public void onAdded() {
        entity.getViewComponent().addChild(FXGL.texture("arrow" + (index++ % 5) + ".png"));
        entity.getBoundingBoxComponent().addHitBox(new HitBox(
                new Point2D(16, 5),
                BoundingShape.box(83, 2)));
    }
}
